<template>
	<view class="userPage">
	    <view class="user-box">
			<image src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fblog%2F202106%2F14%2F20210614124957_0e2ad.jpg&refer=http%3A%2F%2Fc-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1672044475&t=00ac7c6f307ae77aa1c2024022f9a24e" mode=""></image>
			<view class="user" @click="goUserPage">
				<image class="avatar" :src="userInfo.avatar_file.url" mode=""></image>
				<view class="nickName">{{userInfo.nickName}}</view>
			</view>
		</view>
		<!--显示订单管理-->
		<view class="card">
			<van-grid :border="false" :column-num="5">
			  <van-grid-item icon="pending-payment" text="待付款" />
			  <van-grid-item icon="tosend" text="待发货" />
			  <van-grid-item icon="logistics" text="待收货" />
			  <van-grid-item icon="paid" text="待确定" />
			  <van-grid-item icon="credit-pay" text="退款/售后" />
			</van-grid>
		</view>

		<!--用户功能列表-->
		<view class="card">
			<van-cell icon="location-o" title="地址管理" @click="goUserModule('address/list')" is-link></van-cell>
			<van-cell icon="coupon-o" title="优惠券" is-link></van-cell>
			<van-cell icon="paid" title="我的钱包" is-link></van-cell>
			<van-cell icon="service-o" title="联系客服" is-link></van-cell>
			<van-cell icon="setting-o" title="设置" is-link></van-cell>
		</view>
		
		<view class="card">
			<van-cell title="微信登录" @click="user(0)" />
			<van-cell title="登录" @click="user(1)" />
			<van-cell title="注册" @click="user(2)" />
		</view>
		
		<tab-bar :index="3"></tab-bar>
	</view>
</template>

<script>
	import Storage from '@/untils/storage.js'
	export default{
		data(){
			return {
				userInfo:{}
			}
		},
		onLoad(){
		    this.userInfo = Storage.userinfo;
		},
		methods:{
			goUserModule(e){
				uni.navigateTo({
					url:`/pages/user/${e}`
				})
			},
			goUserPage(e){
				if(!Storage.TokenOut){
					uni.navigateTo({
						url:"/uni_modules/uni-id-pages/pages/login/login-withpwd"
					})
				}else{
					uni.navigateTo({
						url:"/uni_modules/uni-id-pages/pages/userinfo/userinfo"
					})
				}
			},
			user(idx){
				let router = [
					"/uni_modules/uni-id-pages/pages/login/login-withoutpwd",
					"/uni_modules/uni-id-pages/pages/login/login-withpwd",
					"/uni_modules/uni-id-pages/pages/register/register"
				    
				];
				uni.navigateTo({
					url:router[idx] 
				})
			}
		}
	}
</script>

<style>
	.uni-app--showtopwindow [data-page="pages/component/view/view"] uni-page-head {
		display: none;
	}
	.userPage{
		background-color: #f2f2f2;
	}
	.user-box{
		width: 100%;
		height: 562upx;
		position: relative;
	}
	.user-box image{
		width: 100%;
		height: 100%;
	}
	.user-box .user{
		position: absolute;
		width: 700upx;
		height: 200upx;
		left: 25upx;
		top: 180upx;
		z-index: 1;
		display: flex;
		align-items: center;
	}
	.user-box .user .avatar{
		width: 100upx;
		height: 100upx;
		margin: 0 30upx;
		border-radius: 100%;
	}
	.user-box .user .nickName{
		font-size: 50upx;
	}
	.card{
		margin: 25upx;
		width: 700upx;
		border-radius: 10upx;
		overflow: hidden;
	}
</style>